home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 2
/
SPACE - Library 2 - Volume 1.iso
/
music
/
213
/
pascal
/
parmtest.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-01-13
|
2KB
|
87 lines
program
NEWTRY (output);
{ This is a very simple test of functional parameter passing.
It should work in any pascal dating from after the revision;
e.g., ISO level 0. It DOES NOT WORK IN PERSONAL PASCAL!
I attempt to compile the program for TOS.
The compile goes well, then just before the loading linker message,
two bombs appear, followed by the link box and then an error box
indicating READ ERROR IN FILE NEWTRY.
At a meeting of the San Leandro Computer Club last year, I
mentioned the problem to Mark Rose. He said that Personal
Pascal DID allow procedural and functional parameters and that
I should make sure I was using the new syntax, rather than the
old J&W syntax. I was. I am. It doesn't work.
I would appreciate an explanation or correction which would allow
me to use this nice feature of pascal--and I still like you guys;
when is version two of Personal Pascal going to appear?
Gary Curtis Newport
27808 Manon Ave. # 18
Hayward, CA 94544
Phone 415-785-2047
Personal Pascal Reg # P61L199C7264
}
CONST
pi = 3.141563;
VAR
x, y : real;
function x_cos (p:real): real;
BEGIN {X_COS}
x_cos := cos(p)
END; {X_COS}
function x_sin (p:real):real;
BEGIN {X_SIN}
x_sin := sin(p)
END; {X_SIN}
function trig( function f(r:real):real; s:real):real;
BEGIN {TRIG}
trig := f(s)
END; {TRIG}
BEGIN {main}
writeln('Now testing for pi/3');
writeln;
y := trig(x_sin, (pi/3));
writeln('sin pi/3 is : ',y);
writeln;
y := trig(x_cos, (pi/3));
writeln('cos pi/3 is : ',y);
END. {NEWTRY}